<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <title>九元包邮仿卷皮网</title>
    <script type="text/javascript" src="../script/api.js"></script>
    <link href="../css/style_v3.css" rel="stylesheet" type="text/css" />
    <link href="../css/main.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../script/jquery.js"></script>
    <script type="text/javascript" src="../script/underscore.js"></script>
    <script type="text/javascript" src="../script/zepto.min.js"></script>
    
    <style>
    #topnav{ width:100%; height:60px; background:#f77;}
    #topnav li{ list-style: none; height:60px; width:25%; line-height: 60px; text-align:center}
    
    
    
    </style>


</head>






<body>

	


	<div class="main">
	
	<!--this is left nav
		<style>
		.app-other {width: 60%;}
		</style>
		<div class="app-other">
		    <ul>
		    
			<li class="normal active ">
		        <a href="">
		        <em class="home"></em>首页</a></li>
		
			<li class="normal  "><a href=""><em style="background-position:-968px 0"></em>九块九包邮</a></li>
			<li class="normal  "><a href=""><em style="background-position:-968px 0"></em>九块九包邮</a></li>
			<li class="normal  "><a href=""><em style="background-position:-968px 0"></em>九块九包邮</a></li>
			<li class="normal  "><a href=""><em style="background-position:-968px 0"></em>九块九包邮</a></li>
	
		           
		        </ul>
		    <p></p> 
		</div>
			
	<!--this is left nav end
	
		<div class="app">
			<!--this is top fixed nav 
			<header id="head" class="head">
			<div class="fixtop">
			<span id="classify" class="classify"><a href="javascript:;" class="btn btn-left btn-type"></a></span>
			<span id="t-index">特卖精选商城</span>
			</div>
			</header>
			
			<div class="nav_box">
				<nav class="nav" id="nav">
					<ul class="">
						<li><a href=""><em class="icon icon-jz"></em><span>首页</span><em class="line"></em></a></li>
						<li><a href=""><em class="icon icon-jk"></em><span>9.9包邮</span><em class="line"></em></a></li>
						<li><a href=""><em class="icon icon-jk"></em><span>19.9包邮</span><em class="line"></em></a></li>
						<li><a href=""><em class="icon icon-jz"></em><span>明日抢</span><em class="line"></em></a></li>
					</ul>
				</nav>
			</div>
			
			<!--this is top fixed nav end-->
			
			
			
			
			<div id="goods">
				<section class="goods" id="goods">
				<ul class="goods-list clear" id="goods_block">

					

				</ul>
				</section>
				<div class="paging">
					<div class="paging-nav">

					</div>
				</div>
			</div>
		
		</div>
	
	</div>


</body>


<script>
apiready = function() {
    initPage();
    //pull to refresh
    api.setRefreshHeaderInfo({
        visible: true,
        // loadingImgae: 'wgt://image/refresh-white.png',
        bgColor: '#f2f2f2',
        textColor: '#4d4d4d',
        textDown: '下拉刷新...',
        textUp: '松开刷新...',
        showTime: true
    }, function(ret, err){
    	initPage();
    });
    
    
    
    //调用下面的返回上一页的函数
		api.addEventListener({
                           name: 'keyback'
                        }, function(ret, err){
                           var js = 'api.historyBack(function(ret, err){if(ret.status){}else{api.closeWidget();}});';
                           api.execScript({
                                           //name:api.winName, 
                               frameName:'frame2',
                               //frameName: api.pageParam.mFrameName,
                               script:js
                           });
                        });
};

function initPage(){

	api.showProgress({
        title: '加载中...',
        modal: false
    });
    
    var html = '';
    api.ajax({
	    //url:'http://www.xinpinghui.com/index.php?m=api',http://www.xinpinghui.com/index.php/api/
	    //url : 'http://news.yongzihao.cn/apicloud/tlist/',
	    url :'http://www.xinpinghui.com/index.php/api/',
	    //url :'http://api.zhe12345.com/index.php',
	    //method:'get',
	    //timeout: 30,
	    dataType: 'json'
    },function(ret,err){
        	
           if (ret) {

			//alert(ret.length);
            var obj = $api.byId('goods_block');
            var len = ret.length;
            for (var i = 0; i < len; i++) {
				
            	var thisItem = ret[i];
            	var newurl = thisItem.android_click_url
            	//alert(thisItem['id']);
				
            	//html += '<li class="item"><a href='+thisItem.android_click_url+'><img class="pic" src='+thisItem.pic_url+' /></a>';
            	//html += '<div><a href='+thisItem.android_click_url+'>'+ thisItem.title +'<p>'+ '</p></div></a></li>';href='+thisItem.android_click_url+'
            	
            	//html +='<li>';
				//html +='		<a   class="goods-a" biz-itemid='+thisItem.num_iid+' isconvert=1 href='+thisItem.android_click_url+'>';
				//html +='			<img class="lazy"  src="'+thisItem.pic_url+'"> ';           
				//html +=			'<span class="icon new">新品</span>';
				//html +=		'</a>';
				//html +=		'<a biz-itemid='+thisItem.num_iid+' isconvert=1 href="http://detail.tmall.com/item.htm?id='+thisItem.num_iid+'"  target="_blank"><h3>'+thisItem.title+'</h3>';
				//html +=		'<div class="list-price buy "><span class="price-new"><i>￥</i>'+thisItem.coupon_price+'</span><i class="del">￥'+thisItem.price+'</i><span class="good-btn"></span></div></a>';
				//html +=     '</li>';
				
				
				html +=		'<li onclick="abc('+thisItem.num_iid+');">';
				html +=		'<a   class="goods-a" biz-itemid='+thisItem.num_iid+' isconvert=1>';
				html +=		'<img class="lazy"  src="'+thisItem.pic_url+'"> ';           
				html +=		'<span class="icon new">新品</span>';
				html +=		'</a>';
				html +=		'<a biz-itemid='+thisItem.num_iid+' isconvert=1 href="http://detail.tmall.com/item.htm?id='+thisItem.num_iid+'"  target="_blank"><h3>'+thisItem.title+'</h3>';
				html +=		'<div class="list-price buy "><span class="price-new"><i>￥</i>'+thisItem.coupon_price+'</span><i class="del">￥'+thisItem.price+'</i><span class="good-btn"></span></div></a>';
				html +=     '</li>';
            	
            	//html += '<img src='+thisItem.pic_url+'/>';
            	//html +='/>';
            	//html += thisItem.title+'</li><br>';
            }
			$api.html(obj, html);
			/*
			for(var i=0;i<ret.length;i++){
                       html+= '<br>'+'ID：'+ret[i].id+'<br>'+'title：'+ret[i].title+'<br>'+'pic:'+ret[i].picurl;        
                }
            var obj = $api.byId('txtNewsList');
			$api.html(obj, html);
			*/			
			api.hideProgress();
			api.refreshHeaderLoadDone();
        } else {        	
           	alert(JSON.stringify(err));
           	api.hideProgress();
        }
     
    });
    
}
function abc(iid){
	var pageParam = api.pageParam; //比如: {"name" : "tans-con"}
	api.openWin({
        name: 'name',
        //pageParam: {name:el,title:tl},
        url: 'opennew.html?iid='+iid,
        opaque: true,
        vScrollBarEnabled: false
   	 });
   	 
   	/*
   	api.openFrame({
	    name: 'page2',
	    url: 'opennew.html?iid='+el,
	   
	    pageParam: {name: 'test'},
	    bounces: true,
	    bgColor: 'rgba(0,0,0,0)',
	    vScrollBarEnabled:true,
	    hScrollBarEnabled:true
	});
	*/
   	 }
   	 
   	     //返回上一页
     function backup(){
     api.addEventListener({
					   name: 'keyback'
					}, function(ret, err){
					   var js = 'api.historyBack(function(ret, err){if(ret.status){alert("历史回退");}else{api.closeWidget();}});';
					   api.execScript({
					       frameName: 'apicloud',
					       script: js
					   });
					});
     	}
     	
     	
     function aboutus(el){
	//var pageParam = api.pageParam; //比如: {"name" : "tans-con"}
	alert(el);
	/*
	api.openWin({
		pageParam : {
			   "el" : el,
			  },
        name: 'name',
        url: 'opennew.html',
        opaque: true,
        vScrollBarEnabled: false,
        
   	 });*/
   	 	}; 
 
</script>
</html>